package com.telecom.entity;


import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Data
public class Teacher {
    @Value("李老师")
    private String name;
    //@Autowired(required = false)//Spring提供的注解，默认按类型装配,要求依赖对象必须存在，不存在则报错
    //@Qualifier("student")
    @Resource  //(name = "student") //jdk提供的注解  使用byName装配，如果byName没有，再按byType装配
    private Student student;

    public void sign(){
        if ("男".equals(student.getSex())){
            System.out.println(student.getName()+"到");
        }else{
            System.out.println(student.getName()+"有");
        }
    }
}
